package com.mystore.framework.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mystore.framework.mapper.FileModelMapper;
import com.mystore.framework.pojo.App;
import com.mystore.framework.pojo.FileModel;
import com.mystore.framework.pojo.Role;
import icu.mhb.mybatisplus.plugln.base.mapper.JoinBaseMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class IFileModelServiceImpl extends IBaseServiceImpl<FileModelMapper,FileModel>{
    @Transactional
    public int insertOne(FileModel t) {
        return baseMapper.insert(t)==0?0:t.getFileModelId();
    }
    @Override
    public IPage<FileModel> selectPageByData(String data, Page<FileModel> page) {
        QueryWrapper<FileModel> queryWrapper=new QueryWrapper<>();
        queryWrapper.apply("(CONCAT_WS('-',file_model_id,file_model_path)) like {0}","%"+data+"%");
        return baseMapper.selectPage(page,queryWrapper);
    }
}
